package com.dong.mybatis.mapper;

import com.dong.mybatis.entity.Zone1AlarmThresholds;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Optional;

/**
 * <p>
 * zone1区域各参数的报警阈值设置 Mapper 接口
 * </p>
 *
 * @author dong
 * @since 2025-09-07
 */
@Mapper
public interface Zone1AlarmThresholdsMapper extends BaseMapper<Zone1AlarmThresholds> {
    @Select("SELECT * FROM zone1_alarm_thresholds WHERE parameter = #{parameter} AND is_enabled = 1")
    Optional<Zone1AlarmThresholds> getEnabledThresholdByParam(String parameter);

   @Update("update zone1_alarm_thresholds set min_value = #{min}, max_value = #{max} where id = #{id}")
    void updateMinMaxById(Double min, Double max, Integer id);
}

